import Mock  from 'mockjs' 
import MockController1 from './apis/MockController1.js' 
// import MockController2 from './apis/MockController2.js' 

// 修复在使用 MockJS 情况下，设置 withCredentials = true，且未被拦截的跨域请求丢失 Cookies 的问题
// https://github.com/nuysoft/Mock/issues/300
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function() {
  if (this.custom.xhr) {
    this.custom.xhr.withCredentials = this.withCredentials || false
  }
  this.proxy_send(...arguments)
}

Mock.setup({
  timeout: '350-600'
})

let mocker=MockController1


// https://48m5b97551.vicp.fun/cs/ad/new

const prefix="/cs"
 
// Mock.mock(new RegExp(`${prefix}/org/page`), 'post', mocker.page)  
// Mock.mock(new RegExp(`${prefix}/org/list`), 'post', mocker.list)  
// Mock.mock(new RegExp(`${prefix}/org/[0-9]+`), 'get', mocker.get)  
// Mock.mock(new RegExp(`${prefix}/org/add`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/org/save$`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/org/delete`), 'post', mocker.page)  

// Mock.mock(new RegExp(`${prefix}/user/get`), 'get', mocker.get)
// Mock.mock(new RegExp(`${prefix}/ad/login`), 'post', mocker.login)
// Mock.mock(new RegExp(`${prefix}/ad/myself`), 'post', mocker.get)  
// Mock.mock(new RegExp(`${prefix}/ad/list`), 'post', mocker.list)  
// Mock.mock(new RegExp(`${prefix}/ad/new`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/ad/update`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/ad/save`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/ad/save-list`), 'post', mocker.saveList)  
// Mock.mock(new RegExp(`${prefix}/ad/delete`), 'post', mocker.saveReturnTrue)  
// Mock.mock(new RegExp(`${prefix}/ad/sort`), 'post', mocker.saveReturnTrue)  

// Mock.mock(new RegExp(`${prefix}/u/list`), 'post', mocker.list)  
// Mock.mock(new RegExp(`${prefix}/u/new`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/u/update`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/u/save`), 'post', mocker.saveReturnId)  
// Mock.mock(new RegExp(`${prefix}/u/save-list`), 'post', mocker.saveList)  
// Mock.mock(new RegExp(`${prefix}/u/delete`), 'post', mocker.saveReturnTrue)  
// Mock.mock(new RegExp(`${prefix}/u/sort`), 'post', mocker.saveReturnTrue)  


 